home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / PipeMan - 263389122001.psc / MainForm.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-09-12  |  18.0 KB  |  588 lines

  1. VERSION 5.00
  2. Begin VB.Form frmMain 
  3.    AutoRedraw      =   -1  'True
  4.    BackColor       =   &H00DBE3E2&
  5.    BorderStyle     =   0  'None
  6.    Caption         =   "PipeMan"
  7.    ClientHeight    =   6210
  8.    ClientLeft      =   0
  9.    ClientTop       =   0
  10.    ClientWidth     =   8265
  11.    Icon            =   "MainForm.frx":0000
  12.    KeyPreview      =   -1  'True
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   6210
  17.    ScaleWidth      =   8265
  18.    StartUpPosition =   2  'CenterScreen
  19.    Begin VB.PictureBox Picture1 
  20.       BackColor       =   &H00C0CFD0&
  21.       Height          =   315
  22.       Left            =   2760
  23.       ScaleHeight     =   255
  24.       ScaleWidth      =   5265
  25.       TabIndex        =   25
  26.       Top             =   360
  27.       Width           =   5325
  28.       Begin VB.Label lblGameInfo 
  29.          Alignment       =   2  'Center
  30.          BackStyle       =   0  'Transparent
  31.          BeginProperty Font 
  32.             Name            =   "Arial"
  33.             Size            =   11.25
  34.             Charset         =   0
  35.             Weight          =   700
  36.             Underline       =   0   'False
  37.             Italic          =   0   'False
  38.             Strikethrough   =   0   'False
  39.          EndProperty
  40.          ForeColor       =   &H00212D2E&
  41.          Height          =   255
  42.          Left            =   0
  43.          TabIndex        =   26
  44.          Top             =   0
  45.          Width           =   5265
  46.       End
  47.    End
  48.    Begin VB.CommandButton cmdScore 
  49.       BackColor       =   &H00C0CFD0&
  50.       Caption         =   "&Hiscore"
  51.       Height          =   495
  52.       Left            =   1080
  53.       Style           =   1  'Graphical
  54.       TabIndex        =   22
  55.       Top             =   4680
  56.       Width           =   975
  57.    End
  58.    Begin VB.CommandButton cmdJump 
  59.       BackColor       =   &H00C0CFD0&
  60.       Caption         =   "&Jump to level"
  61.       Enabled         =   0   'False
  62.       Height          =   495
  63.       Left            =   120
  64.       Style           =   1  'Graphical
  65.       TabIndex        =   21
  66.       Top             =   4680
  67.       Width           =   975
  68.    End
  69.    Begin VB.Timer Timer 
  70.       Enabled         =   0   'False
  71.       Interval        =   50
  72.       Left            =   2280
  73.       Top             =   3240
  74.    End
  75.    Begin VB.Frame Frame 
  76.       BackColor       =   &H00DBE3E2&
  77.       BorderStyle     =   0  'None
  78.       ClipControls    =   0   'False
  79.       Enabled         =   0   'False
  80.       Height          =   1815
  81.       Left            =   120
  82.       TabIndex        =   8
  83.       Top             =   1560
  84.       Width           =   1935
  85.       Begin VB.TextBox txtPipesLeft 
  86.          BackColor       =   &H00EEF1F2&
  87.          ForeColor       =   &H00000000&
  88.          Height          =   285
  89.          Left            =   0
  90.          Locked          =   -1  'True
  91.          TabIndex        =   19
  92.          Text            =   "0"
  93.          Top             =   840
  94.          Width           =   855
  95.       End
  96.       Begin VB.TextBox txtElapsed 
  97.          BackColor       =   &H00EEF1F2&
  98.          ForeColor       =   &H00000000&
  99.          Height          =   285
  100.          Left            =   0
  101.          Locked          =   -1  'True
  102.          TabIndex        =   17
  103.          Text            =   "0"
  104.          Top             =   1440
  105.          Width           =   855
  106.       End
  107.       Begin VB.TextBox txtMultiply 
  108.          BackColor       =   &H00EEF1F2&
  109.          ForeColor       =   &H00000000&
  110.          Height          =   285
  111.          Left            =   1080
  112.          Locked          =   -1  'True
  113.          TabIndex        =   15
  114.          Text            =   "0"
  115.          Top             =   1440
  116.          Width           =   855
  117.       End
  118.       Begin VB.TextBox txtTrigTime 
  119.          BackColor       =   &H00EEF1F2&
  120.          ForeColor       =   &H00000000&
  121.          Height          =   285
  122.          Left            =   0
  123.          Locked          =   -1  'True
  124.          TabIndex        =   11
  125.          Text            =   "0"
  126.          Top             =   240
  127.          Width           =   855
  128.       End
  129.       Begin VB.TextBox txtScore 
  130.          BackColor       =   &H00EEF1F2&
  131.          ForeColor       =   &H00000000&
  132.          Height          =   285
  133.          Left            =   1080
  134.          Locked          =   -1  'True
  135.          TabIndex        =   10
  136.          Text            =   "0"
  137.          Top             =   240
  138.          Width           =   855
  139.       End
  140.       Begin VB.TextBox txtBonus 
  141.          BackColor       =   &H00EEF1F2&
  142.          ForeColor       =   &H00000000&
  143.          Height          =   285
  144.          Left            =   1080
  145.          Locked          =   -1  'True
  146.          TabIndex        =   9
  147.          Text            =   "0"
  148.          Top             =   840
  149.          Width           =   855
  150.       End
  151.       Begin VB.Label Label3 
  152.          BackStyle       =   0  'Transparent
  153.          Caption         =   "Pipes to win"
  154.          ForeColor       =   &H00000000&
  155.          Height          =   255
  156.          Left            =   0
  157.          TabIndex        =   20
  158.          Top             =   600
  159.          Width           =   855
  160.       End
  161.       Begin VB.Label Label6 
  162.          BackStyle       =   0  'Transparent
  163.          Caption         =   "Elapsed"
  164.          ForeColor       =   &H00000000&
  165.          Height          =   255
  166.          Left            =   0
  167.          TabIndex        =   18
  168.          Top             =   1200
  169.          Width           =   855
  170.       End
  171.       Begin VB.Label Label5 
  172.          BackStyle       =   0  'Transparent
  173.          Caption         =   "Multiply"
  174.          Height          =   255
  175.          Left            =   1080
  176.          TabIndex        =   16
  177.          Top             =   1200
  178.          Width           =   855
  179.       End
  180.       Begin VB.Label Label1 
  181.          BackStyle       =   0  'Transparent
  182.          Caption         =   "Trigger time"
  183.          ForeColor       =   &H00000000&
  184.          Height          =   255
  185.          Left            =   0
  186.          TabIndex        =   14
  187.          Top             =   0
  188.          Width           =   855
  189.       End
  190.       Begin VB.Label Label2 
  191.          BackStyle       =   0  'Transparent
  192.          Caption         =   "Score"
  193.          ForeColor       =   &H00000000&
  194.          Height          =   255
  195.          Left            =   1080
  196.          TabIndex        =   13
  197.          Top             =   0
  198.          Width           =   855
  199.       End
  200.       Begin VB.Label Label4 
  201.          BackStyle       =   0  'Transparent
  202.          Caption         =   "Bonus"
  203.          ForeColor       =   &H00000000&
  204.          Height          =   255
  205.          Left            =   1080
  206.          TabIndex        =   12
  207.          Top             =   600
  208.          Width           =   855
  209.       End
  210.    End
  211.    Begin VB.PictureBox picAppBar 
  212.       AutoRedraw      =   -1  'True
  213.       BorderStyle     =   0  'None
  214.       Height          =   300
  215.       Left            =   30
  216.       ScaleHeight     =   300
  217.       ScaleWidth      =   8205
  218.       TabIndex        =   7
  219.       Top             =   30
  220.       Width           =   8205
  221.       Begin VB.Image picControl 
  222.          Height          =   270
  223.          Index           =   0
  224.          Left            =   7635
  225.          Tag             =   "Minimize"
  226.          Top             =   15
  227.          Width           =   270
  228.       End
  229.       Begin VB.Image picControl 
  230.          Height          =   270
  231.          Index           =   1
  232.          Left            =   7920
  233.          Tag             =   "Exit"
  234.          Top             =   15
  235.          Width           =   270
  236.       End
  237.    End
  238.    Begin VB.CommandButton Command2 
  239.       Caption         =   "SAVELOGO"
  240.       Height          =   495
  241.       Left            =   2160
  242.       TabIndex        =   6
  243.       Top             =   4080
  244.       Width           =   615
  245.       Visible         =   0   'False
  246.    End
  247.    Begin VB.CommandButton cmdSpeed 
  248.       BackColor       =   &H00C0CFD0&
  249.       Caption         =   "Speed &up"
  250.       Enabled         =   0   'False
  251.       Height          =   495
  252.       Left            =   1080
  253.       Style           =   1  'Graphical
  254.       TabIndex        =   5
  255.       Top             =   4080
  256.       Width           =   975
  257.    End
  258.    Begin VB.CommandButton cmdPause 
  259.       BackColor       =   &H00C0CFD0&
  260.       Caption         =   "&Pause"
  261.       Enabled         =   0   'False
  262.       Height          =   495
  263.       Left            =   120
  264.       Style           =   1  'Graphical
  265.       TabIndex        =   3
  266.       Top             =   4080
  267.       Width           =   975
  268.    End
  269.    Begin VB.PictureBox picBoxes 
  270.       AutoRedraw      =   -1  'True
  271.       BackColor       =   &H00C0CFD0&
  272.       Height          =   2460
  273.       Left            =   2160
  274.       ScaleHeight     =   2400
  275.       ScaleWidth      =   480
  276.       TabIndex        =   1
  277.       Top             =   720
  278.       Width           =   540
  279.    End
  280.    Begin VB.PictureBox picField 
  281.       AutoRedraw      =   -1  'True
  282.       BackColor       =   &H00C0CFD0&
  283.       Height          =   5340
  284.       Left            =   2760
  285.       ScaleHeight     =   5280
  286.       ScaleWidth      =   5280
  287.       TabIndex        =   0
  288.       Top             =   720
  289.       Width           =   5340
  290.       Begin VB.PictureBox picPause 
  291.          AutoRedraw      =   -1  'True
  292.          BackColor       =   &H00C0CFD0&
  293.          BorderStyle     =   0  'None
  294.          Height          =   5280
  295.          Left            =   0
  296.          ScaleHeight     =   5280
  297.          ScaleWidth      =   5280
  298.          TabIndex        =   27
  299.          Top             =   0
  300.          Width           =   5280
  301.          Visible         =   0   'False
  302.       End
  303.    End
  304.    Begin VB.CommandButton cmdStop 
  305.       BackColor       =   &H00C0CFD0&
  306.       Caption         =   "S&top"
  307.       Enabled         =   0   'False
  308.       Height          =   495
  309.       Left            =   1080
  310.       Style           =   1  'Graphical
  311.       TabIndex        =   4
  312.       Top             =   3480
  313.       Width           =   975
  314.    End
  315.    Begin VB.CommandButton cmdStart 
  316.       BackColor       =   &H00C0CFD0&
  317.       Caption         =   "&Start"
  318.       Height          =   495
  319.       Left            =   120
  320.       Style           =   1  'Graphical
  321.       TabIndex        =   2
  322.       Top             =   3480
  323.       Width           =   975
  324.    End
  325.    Begin VB.OptionButton optSpeed 
  326.       BackColor       =   &H00DBE3E2&
  327.       Caption         =   "Sp&eed pipe"
  328.       ForeColor       =   &H00000000&
  329.       Height          =   495
  330.       Left            =   1080
  331.       TabIndex        =   24
  332.       Top             =   5280
  333.       Value           =   -1  'True
  334.       Width           =   975
  335.    End
  336.    Begin VB.OptionButton optCheck 
  337.       BackColor       =   &H00DBE3E2&
  338.       Caption         =   "&Check pipe"
  339.       Enabled         =   0   'False
  340.       ForeColor       =   &H00000000&
  341.       Height          =   495
  342.       Left            =   120
  343.       TabIndex        =   23
  344.       Top             =   5280
  345.       Width           =   975
  346.    End
  347.    Begin VB.Image LogoLine 
  348.       Height          =   90
  349.       Left            =   30
  350.       Stretch         =   -1  'True
  351.       Top             =   1305
  352.       Width           =   2130
  353.    End
  354.    Begin VB.Image LogoImg 
  355.       Height          =   660
  356.       Left            =   240
  357.       Top             =   480
  358.       Width           =   1800
  359.    End
  360. Attribute VB_Name = "frmMain"
  361. Attribute VB_GlobalNameSpace = False
  362. Attribute VB_Creatable = False
  363. Attribute VB_PredeclaredId = True
  364. Attribute VB_Exposed = False
  365. Private Sub cmdPause_Click()
  366.   PauseGame
  367. End Sub
  368. Private Sub cmdScore_Click()
  369.   ShowHiscore False
  370. End Sub
  371. Private Sub cmdSpeed_Click()
  372.   If TriggerTime > 0 Then
  373.     Bonus = Bonus + (Fix(TriggerTime / 1.25) * 5) * BonusMulti
  374.     TriggerTime = 0
  375.     UpdateBoard
  376.   Else
  377.     Speed = Speed / 2
  378.     If SpeedMulti = False Then
  379.       BonusMulti = BonusMulti + 1
  380.       UpdateBoard
  381.       
  382.       SpeedMulti = True
  383.       End If
  384.     End If
  385. End Sub
  386. Private Sub cmdStart_Click()
  387.   Dim Continue As Boolean
  388.   cmdStart.Enabled = False
  389.   cmdStop.Enabled = True
  390.   cmdPause.Enabled = True
  391.   cmdSpeed.Enabled = True
  392.   cmdScore.Enabled = False
  393.   optSpeed.Enabled = False
  394.   ElapsedTime = MSTimer
  395.   Timer.Enabled = True
  396.   Force = False
  397.   Score = 0
  398.   Bonus = 0
  399.   CurrentMap = 0
  400.   NextMap
  401.     TimeLoop
  402.     WaterLoop
  403.     Score = Score + Int(Bonus)
  404.     UpdateBoard
  405.     EmptyBoxes
  406.     Continue = False
  407.     If Force = False Then
  408.       If WinPipe = 0 Then
  409.         PauseLoop 2000
  410.         ShowPicture NextMapPic
  411.         PauseLoop 2000
  412.         NextMap
  413.         Continue = True
  414.         End If
  415.       End If
  416.   Loop Until Continue = False Or Force
  417.   StopGame
  418.   Timer.Enabled = False
  419.   PauseLoop 2000
  420.   ShowPicture GameOverPic
  421.   UpdateBoard
  422.   Dim Position As Integer
  423.   Position = NewScore(Score)
  424.   If Position > 0 Then
  425.     PauseLoop 1000
  426.     HighScore(Position).Score = Score
  427.     ShowHiscore True
  428.     EnterName = ""
  429.     EnterX = 0
  430.     EnterY = Position
  431.     DrawBox EnterX * PipeSize, EnterY * PipeSize, 100
  432.     EnterHiscore
  433.     EnterLoop
  434.     HighScore(Position).Player = EnterName
  435.     SaveHiscore "hiscore.fdi"
  436.     ShowHiscore False
  437.   Else
  438.     cmdScore.Enabled = True
  439.     End If
  440.   optSpeed.Enabled = True
  441.   cmdStart.Enabled = True
  442. End Sub
  443. Private Sub cmdStop_Click()
  444.   StopGame
  445. End Sub
  446. Private Sub Command2_Click()
  447.   Dim asd As New PipeMan.Write
  448.   asd.SaveFile "pipelogo.fdi", False
  449.   asd.WriteString "PMPL", 4
  450.   A = "0000000000007474714730020222222000241122213006522222630000000000000742273734002222201150022221326400656563202000000000000"
  451.   For X = 0 To 10
  452.   For Y = 0 To 10
  453.     asd.WriteValue Mid(A, Y * 11 + X + 1, 1), 4
  454.   Next
  455.   Next
  456.   A = "0000000000074273202313261206150202021371402020263202020000000000000714734734002222021350022213120000222202200000000000000"
  457.   For X = 0 To 10
  458.   For Y = 0 To 10
  459.     asd.WriteValue Mid(A, Y * 11 + X + 1, 1), 4
  460.   Next
  461.   Next
  462.   A = "00000000000" & _
  463.       "07342734730" & _
  464.       "01352135200" & _
  465.       "02002200130" & _
  466.       "02002200630" & _
  467.       "00000000000" & _
  468.       "07147347420" & _
  469.       "02222022610" & _
  470.       "02221312020" & _
  471.       "02222022020" & _
  472.       "00000000000"
  473.   For X = 0 To 10
  474.   For Y = 0 To 10
  475.     asd.WriteValue Mid(A, Y * 11 + X + 1, 1), 4
  476.   Next
  477.   Next
  478.   A = "00000000000" & _
  479.       "00000000000" & _
  480.       "00000000000" & _
  481.       "73474227373" & _
  482.       "13522226413" & _
  483.       "20011220220" & _
  484.       "20022653563" & _
  485.       "00000000000" & _
  486.       "00000000000" & _
  487.       "00000000000" & _
  488.       "00000000000"
  489.   For X = 0 To 10
  490.   For Y = 0 To 10
  491.     asd.WriteValue Mid(A, Y * 11 + X + 1, 1), 4
  492.   Next
  493.   Next
  494.   asd.CloseFile False
  495. End Sub
  496. Private Sub Command3_Click()
  497. End Sub
  498. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  499.   If (Shift Mod 2 ^ (3 - 1) <> Shift Mod 2 ^ 3) And KeyCode = 115 Then
  500.     End
  501.     End If
  502.   If GameOver = True And KeyCode = 27 And Shift = 0 Then
  503.     PauseGame True
  504.     frmMain.WindowState = 1
  505.     End If
  506. End Sub
  507. Private Sub Form_KeyPress(KeyAscii As Integer)
  508.   If EnterMode = True Then
  509.     Dim Value As Integer
  510.     Dim PipeType As Integer
  511.     Value = Asc(UCase(Chr(KeyAscii)))
  512.     If Value = 32 Then
  513.       PipeType = 101
  514.     ElseIf Value >= 65 And Value <= 90 Then
  515.       PipeType = Value + 235
  516.     ElseIf Value = 8 And EnterX > 0 Then
  517.       EnterX = EnterX - 1
  518.       EnterName = Left(EnterName, Len(EnterName) - 1)
  519.       PipeType = 100
  520.     ElseIf Value = 13 Then
  521.       EnterMode = False
  522.       End If
  523.     If PipeType > 0 And Len(EnterName) < 6 Then
  524.       DrawBox EnterX * PipeSize, EnterY * PipeSize, PipeType - (PipeType = 100)
  525.       
  526.       If Len(EnterName) + (PipeType = 100) < 5 Then
  527.         DrawBox (EnterX + 1 + (PipeType = 100)) * PipeSize, EnterY * PipeSize, 100
  528.         End If
  529.       If PipeType = 100 And Len(EnterName) < 5 Then
  530.         DrawBox (EnterX + 1) * PipeSize, EnterY * PipeSize, 101
  531.         End If
  532.         
  533.       If PipeType <> 100 Then
  534.         EnterX = EnterX + 1
  535.         EnterName = EnterName & Chr(Value)
  536.         End If
  537.       End If
  538.     End If
  539. End Sub
  540. Private Sub Form_Unload(Cancel As Integer)
  541.   End
  542. End Sub
  543. Private Sub picAppBar_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  544.   If Button = 1 Then
  545.     MX = X
  546.     MY = Y
  547.     End If
  548. End Sub
  549. Private Sub picAppBar_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  550.   If Button = 1 Then
  551.     frmMain.Move frmMain.Left + X - MX, frmMain.Top + Y - MY
  552.     End If
  553. End Sub
  554. Private Sub picControl_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  555.   If Button = 1 Then
  556.     picControl(Index).Picture = LoadResPicture("DOWN" & picControl(Index).Tag, 0)
  557.     End If
  558. End Sub
  559. Private Sub picControl_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  560.   If Button = 1 Then
  561.     If X >= 0 And Y >= 0 And X <= 270 And Y <= 270 Then
  562.       picControl(Index).Picture = LoadResPicture("DOWN" & picControl(Index).Tag, 0)
  563.     Else
  564.       picControl(Index).Picture = LoadResPicture("UP" & picControl(Index).Tag, 0)
  565.       End If
  566.     End If
  567. End Sub
  568. Private Sub picControl_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  569.   If Button = 1 And X >= 0 And Y >= 0 And X <= 270 And Y <= 270 Then
  570.       Select Case Index
  571.         Case 0
  572.           PauseGame True
  573.           frmMain.WindowState = 1
  574.         Case 1
  575.           End
  576.       End Select
  577.     End If
  578.   picControl(Index).Picture = LoadResPicture("UP" & picControl(Index).Tag, 0)
  579. End Sub
  580. Private Sub picField_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  581.   If Button = 1 And GameOver = False And Pause = False Then
  582.       PlaceBox CInt(X), CInt(Y)
  583.       End If
  584. End Sub
  585. Private Sub Timer_Timer()
  586.   frmMain.txtElapsed = Int((MSTimer - ElapsedTime) / 1000)
  587. End Sub
  588.